import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceClockingRecordVO, DeviceClockingRecordForm, DeviceClockingRecordQuery } from '@/api/device/deviceClockingRecord/types';

/**
 * 查询设备打卡记录列表
 * @param query
 * @returns {*}
 */

export const listDeviceClockingRecord = (query?: DeviceClockingRecordQuery): AxiosPromise<DeviceClockingRecordVO[]> => {
  return request({
    url: '/device/deviceClockingRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备打卡记录详细
 * @param id
 */
export const getDeviceClockingRecord = (id: string | number): AxiosPromise<DeviceClockingRecordVO> => {
  return request({
    url: '/device/deviceClockingRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增设备打卡记录
 * @param data
 */
export const addDeviceClockingRecord = (data: DeviceClockingRecordForm) => {
  return request({
    url: '/device/deviceClockingRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备打卡记录
 * @param data
 */
export const updateDeviceClockingRecord = (data: DeviceClockingRecordForm) => {
  return request({
    url: '/device/deviceClockingRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备打卡记录
 * @param id
 */
export const delDeviceClockingRecord = (id: string | number | Array<string | number>) => {
  return request({
    url: '/device/deviceClockingRecord/' + id,
    method: 'delete'
  });
};
